<template>
  <div>
    <div class="container">
      <div class="handle-box">
        <el-select v-model="query.case_source" @change="handleSearch(query.case_number,query.tcs_note_id,query.case_source,query.case_type)" clearable placeholder="案件来源" class="handle-select mr10">
          <el-option key="1" label="市场查获" value="市场查获"></el-option>
          <el-option key="2" label="投诉举报" value="投诉举报"></el-option>
          <el-option key="3" label="上级交办" value="上级交办"></el-option>
        </el-select>
        <el-select v-model="query.case_type" @change="handleSearch(query.case_number,query.tcs_note_id,query.case_source,query.case_type)" clearable placeholder="案件性质" class="handle-select mr10">
          <el-option key="1" label="一般案件" value="一般案件"></el-option>
          <el-option key="2" label="简易案件" value="简易案件"></el-option>
        </el-select>
        <el-input v-model="query.case_number" placeholder="立案编号" @change="handleSearch(query.case_number,query.tcs_note_id,query.case_source,query.case_type)" class="handle-input mr10"></el-input>
        <el-button type="primary" :icon="Search" @change="handleSearch(query.case_number,query.tcs_note_id,query.case_source,query.case_type)">搜索</el-button>
      </div>
      <el-table :data="tableList" border class="table" ref="multipleTable" header-cell-class-name="table-header">
        <el-table-column prop="case_source" label="案件来源" align="center"></el-table-column>
        <el-table-column prop="case_number" label="立案编号" width="200"  align="center"></el-table-column>
        <el-table-column prop="case_update_time" label="更新时间"  align="center"></el-table-column>
        <el-table-column prop="case_type" label="案件性质" align="center"></el-table-column>
        <el-table-column prop="date_of_filing" label="立案日期"  align="center"></el-table-column>
        <el-table-column label="卷烟喷码记录表状态" align="center" width="180">
          <template #default="scope">
            <div v-if="scope.row.tcs_note_id === '喷码记录表填写开始' ">
              <el-tag :type=" 'danger'">喷码记录表填写开始 </el-tag>
            </div>
            <div v-if="scope.row.tcs_note_id === '喷码记录表已完成' ||
            scope.row.tcs_note_id === '立案报告表已完成' ||
            scope.row.tcs_note_id === '立案报告表审核已完成' ||
            scope.row.tcs_note_id === '卷烟鉴别书已完成' ||
            scope.row.tcs_note_id === '涉案烟草价品核案表完成' ||
            scope.row.tcs_note_id === '询问笔录已完成' ||
            scope.row.tcs_note_id === '已完成' ||
            scope.row.tcs_note_id === '无证经营公示已完成' ||
            scope.row.tcs_note_id === '立案报告表主任审核已完成'||
            scope.row.tcs_note_id ==='卷烟鉴别书已送检'||
            scope.row.tcs_note_id ==='调查终结文书已完成'||
            scope.row.tcs_note_id ==='案件处理审批已开始'||
            scope.row.tcs_note_id ==='集体讨论已开始'||
            scope.row.tcs_note_id ==='集体讨论已完成'||
            scope.row.tcs_note_id ==='听证已开始'||
            scope.row.tcs_note_id ==='听证告知书已完成'||
            scope.row.tcs_note_id ==='听证已完成'||
            scope.row.tcs_note_id ==='案件处理审批已完成'||
            scope.row.tcs_note_id ==='行政处罚事先告知书确认完成'||
            scope.row.tcs_note_id ==='行政处罚事先告知书已完成'||
            scope.row.tcs_note_id ==='行政处罚决定书确认完成'||
            scope.row.tcs_note_id ==='行政处罚决定书已完成'||
            scope.row.tcs_note_id ==='行政罚款收据上传完成'||
            scope.row.tcs_note_id ==='撤案集体讨论准备'||
            scope.row.tcs_note_id ==='撤案集体讨论已开始'||
            scope.row.tcs_note_id ==='卷烟鉴别抽样单填写开始'||
            scope.row.tcs_note_id ==='卷烟鉴别委托书填写开始'||
            scope.row.tcs_note_id ==='上传送检结果开始'||
            scope.row.tcs_note_id ==='结案报告表已完成'">
              <el-tag :type=" 'success'">已完成 </el-tag>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="下一步操作" width="300" align="center">
          <template #default="scope">
            <div v-if="scope.row.tcs_note_id === '喷码记录表填写开始' ">
              <el-button text :icon="Edit" class="blue" @click="inkjet_record_confirm(scope.row)" >
                喷码记录表查看及确认
              </el-button>
            </div>

            <div v-if="scope.row.tcs_note_id === '喷码记录表已完成' ||
            scope.row.tcs_note_id === '立案报告表已完成' ||
            scope.row.tcs_note_id === '立案报告表审核已完成' ||
            scope.row.tcs_note_id === '卷烟鉴别书已完成' ||
            scope.row.tcs_note_id === '涉案烟草价品核案表完成' ||
            scope.row.tcs_note_id === '询问笔录已完成' ||
            scope.row.tcs_note_id === '已完成' ||
            scope.row.tcs_note_id === '无证经营公示已完成' ||
            scope.row.tcs_note_id === '立案报告表主任审核已完成'||
            scope.row.tcs_note_id ==='卷烟鉴别书已送检'||
            scope.row.tcs_note_id ==='调查终结文书已完成'||
            scope.row.tcs_note_id ==='案件处理审批已开始'||
            scope.row.tcs_note_id ==='集体讨论已开始'||
            scope.row.tcs_note_id ==='集体讨论已完成'||
            scope.row.tcs_note_id ==='听证已开始'||
            scope.row.tcs_note_id ==='听证告知书已完成'||
            scope.row.tcs_note_id ==='听证已完成'||
            scope.row.tcs_note_id ==='案件处理审批已完成'||
            scope.row.tcs_note_id ==='行政处罚事先告知书确认完成'||
            scope.row.tcs_note_id ==='行政处罚事先告知书已完成'||
            scope.row.tcs_note_id ==='行政处罚决定书确认完成'||
            scope.row.tcs_note_id ==='行政处罚决定书已完成'||
            scope.row.tcs_note_id ==='行政罚款收据上传完成'||
            scope.row.tcs_note_id ==='撤案集体讨论准备'||
            scope.row.tcs_note_id ==='撤案集体讨论已开始'||
            scope.row.tcs_note_id ==='卷烟鉴别抽样单填写开始'||
            scope.row.tcs_note_id ==='卷烟鉴别委托书填写开始'||
            scope.row.tcs_note_id ==='上传送检结果开始'||
            scope.row.tcs_note_id ==='结案报告表已完成'">
              <el-button text :icon="Edit" class="blue" @click="inkjet_record_print(scope.row.case_id)" >
                查看涉案卷烟喷码记录表
              </el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination">
        <el-pagination
            background
            layout="total, prev, pager, next"
            :current-page="query.pageIndex"
            :page-size="query.pageSize"
            :total="pageTotal"
            @current-change="handlePageChange"
        ></el-pagination>
      </div>
    </div>

    <el-dialog title="喷码记录表" v-model="Printing_record_Visible" width="70%">
      <el-table :data="inkjet_record_Data" border class="table" ref="multipleTable" header-cell-class-name="table-header">
<!--        <el-table-column prop="case_id" label="案件号"  align="center"></el-table-column>-->
<!--        <el-table-column prop="record_id" label="喷码号"  align="center"></el-table-column>-->
        <el-table-column prop="ciga_variety" label="卷烟品种"   align="center"></el-table-column>
        <el-table-column prop="inkjet" label="卷烟喷码"   align="center"></el-table-column>
        <el-table-column prop="barcode" label="条形码"   align="center"></el-table-column>
        <el-table-column prop="ciga_model" label="规格型号" width="100"  align="center"></el-table-column>
        <el-table-column prop="ciga_price" label="卷烟价格"  width="100"  align="center"></el-table-column>
        <el-table-column prop="evi_id_number" width="170px" label="先行保存通知书号码"   align="center"></el-table-column>
        <el-table-column label="操作"  align="center">

          <template #default="scope">
            <el-button class="blue" text :icon="Edit" @click="inkjetEdit(scope.$index, scope.row)" >
              修改
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <template #footer>
				<span class="dialog-footer">
					<el-button @click="Printing_record_Visible = false">取 消</el-button>
          <el-button text :icon="Edit" class="blue" @click="inkjet_record_print(create_case.case_id)" >
                预览
              </el-button>
          <el-button type="primary" @click="certain_inkjet">确 定</el-button>
				</span>
      </template>
    </el-dialog>

    <el-dialog title="喷码记录表" v-model="inkjet_record_print_Visible" width="70%">
      <el-table :data="inkjet_record_print_Data" border class="table" ref="multipleTable" header-cell-class-name="table-header">
        <!--        <el-table-column prop="case_id" label="案件号"  align="center"></el-table-column>-->
        <!--        <el-table-column prop="record_id" label="喷码号"  align="center"></el-table-column>-->
        <el-table-column prop="evi_id_number" width="170px" label="先行保存通知书号码"   align="center"></el-table-column>
        <el-table-column prop="tce_type_number" label="共计（品种）"   align="center"></el-table-column>
        <el-table-column prop="tce_number" label="合计（数量）"   align="center"></el-table-column>
        <el-table-column prop="tce_amount" label="总金额"  align="center"></el-table-column>
        <el-table-column prop="user_name_1" label="执法员1"   align="center"></el-table-column>
        <el-table-column prop="user_name_2" label="执法员2"   align="center"></el-table-column>
        <el-table-column prop="mer_person" label="当事人"   align="center"></el-table-column>
<!--        <el-table-column prop="tce_address" label="登记保存地点"   align="center"></el-table-column>-->
        <el-table-column label="操作"  align="center" width="193px">

          <template #default="scope"><!--v-permiss="15"-->
            <el-button  text :icon="Edit" @click="views_inkjet_record_data(scope.$index, scope.row)" >
              查看
            </el-button>

            <el-button  text :icon="Printer" @click="Print_Inkjet_Record(scope.$index, scope.row)" >
              打印
            </el-button>

          </template>
        </el-table-column>
      </el-table>

    </el-dialog>

    <!--    //查看卷烟喷码-->
    <el-dialog title="" v-model="Inkjet_record_Browse_Visible" width="45%">
      <html>
      <head>
        <title>涉案卷烟喷码明细表</title>
      </head>
      <body>
      <h1 align="center">
        福建省闽侯县烟草专卖局
      </h1>
      <h2 align="center">
        涉案卷烟喷码明细表
      </h2>

      <table border="1" style="border-collapse: collapse;" width="100%">
        <tr>
          <th colspan="1" width="15.8%">先行登记保存通知书号</th>
          <th colspan="4">侯烟存准【<b><u>{{inkjet_record_view_data.year}}</u></b>】第<b><u>{{inkjet_record_view_data.evi_id_number}}</u></b>号</th>
        </tr>
        <tr>
          <td height="30px" width="15.8" align="center"><strong>卷烟品名</strong></td>
          <th width="25%">条形码</th>
          <th colspan="2" width="46%">喷码明细</th>
          <th width="8.5%">数量(条)</th>
        </tr>
      </table>
      <div v-for="item in inkjet_record_view_data.list">
      <table border="1" style="border-collapse: collapse;" width="100%" >
        <tr>
          <th  width="15.8%">{{item.ciga_variety}}</th>
          <th width="25%"> {{ item.barcode }}</th>
          <th  width="23%">{{ item.inkjet }}</th>
          <th  width="23%">{{ item.inkjet }}</th>
          <td height="40px" width="8.5%" align="center"><strong>{{ item.evi_number }}</strong></td>
        </tr>
      </table>
      </div>
      <table border="1" style="border-collapse: collapse;" width="100%">
        <tr>
          <td height="45px" colspan="2" width="42.8%" align="center"><strong>共计（品种）:{{inkjet_record_view_data.tce_type_number}}品种</strong></td>
          <td height="45px" colspan="3" align="center"><strong>合计（数量）:{{inkjet_record_view_data.tce_number}}</strong></td>
        </tr>
        <tr>
          <td height="55px" colspan="2" align="center" width="42.8%"><strong>执法人员:{{inkjet_record_view_data.user_name_1}}、{{inkjet_record_view_data.user_name_2}}</strong></td>
          <td height="55px" colspan="3" align="center" ><strong>当事人:{{inkjet_record_view_data.mer_person}}</strong></td>
        </tr>
      </table>
      </body>
      </html>
    </el-dialog>


    <!-- 修改弹出框 -->
    <el-dialog title="卷烟喷码修改" v-model="InkjeteditVisible" width="60%">
      <el-form label-width="80px">
        <el-form-item label="案件号">
          <el-input v-model="inkjet_record_data_storage.case_id" :disabled="true"></el-input>
        </el-form-item>
<!--        <el-form-item label="喷码号">-->
<!--          <el-input v-model="inkjet_record_data_storage.record_id" :disabled="true"></el-input>-->
<!--        </el-form-item>-->
        <el-form-item label="通知书号" >
          <el-input v-model="inkjet_record_data_storage.evi_id_number" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="卷烟品种">
          <el-input v-model="inkjet_record_data_storage.ciga_variety" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="卷烟喷码">
          <el-input v-model="inkjet_record_data_storage.inkjet" ></el-input>
        </el-form-item>
        <el-form-item label="条形码">
          <el-input v-model="inkjet_record_data_storage.barcode" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="规格型号">
          <el-input v-model="inkjet_record_data_storage.ciga_model" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="卷烟价格">
          <el-input v-model="inkjet_record_data_storage.ciga_price" :disabled="true"></el-input>
        </el-form-item>

      </el-form>
      <template #footer>
				<span class="dialog-footer">
					<el-button @click="InkjeteditVisible = false">取 消</el-button>
					<el-button type="primary" @click="saveInkjetEdit">确 定</el-button>
				</span>
      </template>
    </el-dialog>

  </div>
</template>

<script setup lang="ts" name="basetable">
import { ref, reactive } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import { Delete,Folder,Printer ,Document,Upload, Edit, Search, Plus } from '@element-plus/icons-vue';
import {
  case_evi_Create,
  case_evi_Views,
  case_legal_Create,
  ciga_evudence_Create,
  end_record_data,
  evi_Views,
  fetchData_case,
  fetchData_case_Create,
  fetchData_case_update,
  fetchData_legal_clause,
  fetchData_mer,
  fetchData_s_mongodb_evidence_Cre,
  fetchData_s_mongodb_evidence_Views,
  fetchData_tobacco,
  fetchData_user,
  illegal_record_data,
  illegal_record_Search,
  mer_Create,
  mer_search_api,
  review_price_data,
  staff_evidence_create,
  staff_evidence_data,
  end_record_show,
  record_inquiry_show,
  record_inquiry_print,
  case_evidence_Views, case_evidence_Edit, inkjet_record_Views, fetchData_price_Edit, fetchData_inkjet_Edit, inkjet_record_print_data_Views, print_inkjet_record_data
} from '../api/index';
import {
  export_word_2,
} from './table_inquiry.vue'

//案件表数据
interface TableItem {
  case_id:number,
  date_of_filing:string,
  date_of_closing:string,
  date_of_archive:string,
  case_source:string,
  case_number:string,
  archive_person:string,
  case_update_time:string,
  ase_type:string,
  case_remark:string,
  tcs_note_id:string,
  ciga_flag:string,
  ciga_num_flag:string,
  mer_flag:string,
}

//案件暂存数据
const create_case = reactive({
  staff_evi_id:0,
  staff_id:0,
  staff_evi_send_per:'',
  staff_evi_check_per1:'',
  staff_evi_check_per2:'',
  staff_evi_send_time:'',
  staff_evi_send_unit:'',
  staff_evi_send_result:'',
  staff_evi_rec_address:'',
  staff_evi_status:'',
  staff_evi_per_note:'',
  mer_flag:'',
  ciga_num_flag:'',
  ciga_flag:'',
  test:[],
  img_data:'',
  standard:'',
  tir_id:0,
  tlc_id:0,
  illegal_behavior:'',
  evi_id_number:'',
  date_of_filing:'',
  date_of_closing:'',
  date_of_archive:'',
  case_source:'',
  case_number:'',
  archive_person:'',
  case_update_time:'',
  case_type:'',
  case_remark:'',
  mer_id:0,
  tcs_note:'',
  case_id:0,
  tce_time:'',
  tce_number:0,
  tce_amount:0,
  tce_remark:'',
  tce_address:'福建省福州市闽侯县烟草专卖局',
  evi_number:0,//数量(条)
  ciga_variety:'',//品种
  barcode:'',//条形码
  ciga_model:'',//规格型号
  ciga_price:0,//单价
  inkjet:'',//
  mer_format:'',
  mer_address:'',
  mer_person:'',
  mer_record:'',
  date_of_record:'',
  date_of_effect:'',
  date_of_issue:'',
  mer_hometown:'',
  mer_id_number:'',
  mer_tel:'',
  business_licence_code:'',
  licence_state:'',
  storage_address:'',
  retail_licence_code:'',
  category:'',
  area_id:0,
  mer_zip_code:0,
  mer_name:'',
  remark:'',
});
//获取商户数据用作选项框
interface mer_data {
  mer_id: number,
  mer_format: string,
  mer_address: string,
  mer_person: string,
  mer_record: string,
  date_of_record: string,
  date_of_effect: string,
  date_of_issue: string,
  mer_hometown: string,
  mer_id_number: string,
  mer_tel: string,
  business_licence_code: string,
  licence_state: string,
  storage_address: string,
  retail_licence_code: string,
  category: string,
  area_id: number,
  mer_zip_code: number,
  mer_name: string,
  evi_id_number:string,
}
const mer_Data = ref<mer_data[]>([]);
const get_mer_opinion = (mer_name:string='',licence_state:string='',mer_person:string='' ,mer_id:number,business_licence_code:string='') =>{
  fetchData_mer(mer_name,licence_state,mer_person,mer_id,business_licence_code).then(res =>{
    mer_Data.value = res.data.data;
  })
}
get_mer_opinion();
//获取执法人员数据作为选择框
interface staff_data{
  staff_id:number,
  staff_name:string,
  staff_gender:string,
  staff_birthday:string,
  staff_ethnicity:string,
  staff_edu_bg:string,
  staff_email:string,
  field_staff_identity_card:string,
  staff_hometown:string,
  staff_degree:string,
  staff_political_status:string,
  staff_post:string,
  staff_account_no:string,
  staff_account_pwd:string,
  staff_starting_time:string,
  staff_authorized:string,
  staff_phone:string,
  staff_tel:string,
  staff_e_sign:string,
  staff_small_number:string,
  staff_license_no:string,
  staff_now_work_degree:string,
  staff_now_evaluate_degree:string,
}
const staff_Data = ref<staff_data[]>([]);
const get_staff_opinion1 = () =>{
  fetchData_user('','','').then(res=>{
    staff_Data.value = res.data.data;
  })
}
get_staff_opinion1();

//获取案由信息数据用作选项框
interface illegal_data {
  tlc_id:number,
  illegal_behavior:string,
  standard:string,
  penalty_range:string,
  statutory_penalty:string,
  grade:string,
  remark:string,
}
const illegal_Data = ref<illegal_data[]>([]);
const get_legal_clause_opinion = (illegal_behavior:string='',standard:string='' ,grade:string='',tlc_id:number) =>{
  fetchData_legal_clause(illegal_behavior, standard,grade,tlc_id).then(res =>{
    illegal_Data.value = res.data.data;
  })
}
get_legal_clause_opinion();


//视图/

const Ratification_Visible = ref(false);                              //批准书视图
const Ratification_Edit_Visible = ref(false);                         //批准书修改视图
const Advice_note_Visible = ref(false);                               //通知书视图
const Advice_note_Views_Visible = ref(false);                         //查看通知书视图
const Printing_record_Visible=ref(false);                             //卷烟喷码视图
const inkjet_record_print_Visible=ref(false);                        //卷烟喷码打印信息
const Inkjet_record_Browse_Visible=ref(false);                         //卷烟喷码浏览信息

//通过案件号查询所有证据先行保存通知书
interface Evidence_case_data {
  case_id:number,//案件号
  evi_id_number:string,
  evi_number:number,
  tce_time_year:string,//案件时间
  tce_time_month:string,
  tce_time_day:string,
  tce_type_number:string,
  tce_number:string,
  tce_amount:number,
  tce_remark:string,
  tce_address:string,
}
const evidence_case_Data= ref<Evidence_case_data[]>([]);
const get_evidence_case_Data = (case_id:number) =>{
  case_evi_Views("" ,case_id).then(res=>{
    evidence_case_Data.value = res.data.data;
  })
}

//卷烟喷码记录
interface Inkjet_record_data{
  inkjet:string,//卷烟喷码
  case_id:number,
  evi_id_number:string,
  ciga_id:number,
  ciga_type:string,
  ciga_variety:string,
  barcode:string,
  ciga_model:string,
  ciga_price:number,
}
//卷烟喷码记录表显示
const inkjet_record_Data=ref<Inkjet_record_data[]>([]);
const get_inkjet_record_Data=(case_id:number)=>{
  inkjet_record_Views(case_id).then(res=>{
    inkjet_record_Data.value=res.data.data;
  })
}

//显示卷烟喷码表
const inkjet_record_confirm=(row:any)=>{
  get_inkjet_record_Data(row.case_id);
  create_case.case_id = row.case_id;
  Printing_record_Visible.value = true;
}



//卷烟喷码记录表确认
const certain_inkjet=()=>{
  create_case.tcs_note = "喷码记录表已完成"
  fetchData_case_update(create_case.case_id,create_case.tcs_note).then(res=>{
    if (res.data.message === "success"){
      ElMessage.success('喷码记录表已完成');
      getData();
      Printing_record_Visible.value = false;
    }else {
      ElMessageBox.confirm('状态更新失败', '提示', {
        type: 'warning'
      })
    }
  })
}

// 卷烟喷码编辑时弹窗和保存
const InkjeteditVisible=ref(false);
let inkjet_record_data_storage=reactive({
  record_id:0,
  inkjet:'',
  case_id:0,
  evi_id_number:'',
  ciga_id:0,
  ciga_type:'',
  ciga_variety:'',
  barcode:'',
  ciga_model:'',
  ciga_price:0,
})
let idx: number = -1;
const inkjetEdit=(index: number,row: any)=>{
  inkjet_record_data_storage.record_id=row.record_id;
  inkjet_record_data_storage.inkjet=row.inkjet;
  inkjet_record_data_storage.case_id=row.case_id;
  inkjet_record_data_storage.evi_id_number=row.evi_id_number;
  inkjet_record_data_storage.ciga_id=row.ciga_id;
  inkjet_record_data_storage.ciga_type=row.ciga_type;
  inkjet_record_data_storage.ciga_variety=row.ciga_variety;
  inkjet_record_data_storage.barcode=row.barcode;
  inkjet_record_data_storage.ciga_model=row.ciga_model;
  inkjet_record_data_storage.ciga_price=row.ciga_price;
  InkjeteditVisible.value=true;
}

//卷烟喷码记录表修改
const saveInkjetEdit=()=>{
  InkjeteditVisible.value=false;
  fetchData_inkjet_Edit(
          inkjet_record_data_storage.case_id,
          inkjet_record_data_storage.ciga_variety,
          inkjet_record_data_storage.inkjet,
          inkjet_record_data_storage.evi_id_number,
          inkjet_record_data_storage.ciga_type,
          inkjet_record_data_storage.barcode,
          inkjet_record_data_storage.ciga_model,
          inkjet_record_data_storage.ciga_price,
  ).then(res=>{
    if (res.data.message === "success"){
      getData()
      ElMessage.success('修改成功');

    }else {
      ElMessageBox.confirm('修改失败', '提示', {
        type: 'warning'
      })
    }});
};



//获取所有的要打印的卷烟喷码的信息
interface Inkjet_record_print_data{
  case_id:number,
  evi_id_number:'',
  tce_type_number:number,
  tce_number:number,
  tce_amount:number,
  tce_address:'',
  user_name_1:'',
  user_name_2:'',
  mer_person:'',
}
const inkjet_record_print_Data=ref<Inkjet_record_print_data[]>([]);
const get_inkjet_record_print_data=(case_id:number)=>{
  inkjet_record_print_data_Views(case_id).then(res=>{
    inkjet_record_print_Data.value=res.data.data;
  })
}

const inkjet_record_print=(case_id:number)=>{
  get_inkjet_record_print_data(case_id);
  create_case.case_id = case_id;
  inkjet_record_print_Visible.value = true;
}

//暂存卷烟喷码查看记录
const inkjet_record_view_data=reactive({
  case_id:0,
  evi_id_number:'',
  year:'',
  tce_type_number:0,
  tce_number:0,
  //tce_address:'',
  user_name_1:'',
  user_name_2:'',
  mer_person:'',
  list:[]
})

const views_inkjet_record_data=(index: number,row:any)=>{
  create_case.evi_id_number=row.evi_id_number;
  print_inkjet_record_data(create_case.case_id,create_case.evi_id_number).then(res=>{
    inkjet_record_view_data.case_id=res.data.data.case_id;
    inkjet_record_view_data.evi_id_number=res.data.data.evi_id_number;
    inkjet_record_view_data.year=res.data.data.year;
    inkjet_record_view_data.tce_type_number=res.data.data.tce_type_number;
    inkjet_record_view_data.tce_number = res.data.data.tce_number;
    inkjet_record_view_data.user_name_1=res.data.data.user_name_1;
    inkjet_record_view_data.user_name_2=res.data.data.user_name_2;
    inkjet_record_view_data.mer_person=res.data.data.mer_person;
    inkjet_record_view_data.list=res.data.data.list;
  })
  Inkjet_record_Browse_Visible.value=true;
}

// const views_inkjet_record_data=(row:any)=>{
//
//   create_case.evi_id_number=row.evi_id_number;
//   //get_inkjet_record_view_data(row);
//   Inkjet_record_Browse_Visible.value=true;
// }

//根据案件号和先行保存通知书号码打印卷烟喷码明细表
const Print_Inkjet_Record=(index: number,row: any)=>{
  create_case.evi_id_number=row.evi_id_number;
  print_inkjet_record_data(create_case.case_id,create_case.evi_id_number).then(res=>{
    export_word_2(
            res.data.data.evi_id_number,
            res.data.data.mer_person,
            res.data.data.year,
            res.data.data.user_name_1,
            res.data.data.user_name_2,
            res.data.data.tce_type_number,
            res.data.data.tce_number,
            res.data.data.list
    )
  })
}

const query = reactive({
  case_source:'',
  case_type:'',
  tcs_note_id:'',
  case_number:'',
  pageIndex: 1,
  pageSize: 10
});
const tableData = ref<TableItem[]>([]);
const tableList = ref<TableItem[]>([]); // 用于存放分页数据的列表
const pageTotal = ref(0);
const name = localStorage.getItem('ms_username');
// 获取表格数据
const getData = (archive_person:string='',case_id:number,case_source:string='',case_type:string='',case_number:string='',tcs_note_id:string='',name:string='') => {
  fetchData_case(archive_person,case_id,case_source,case_type,case_number,tcs_note_id,name).then(res => {
    tableData.value = res.data.data.filter((i: { tcs_note_id: string; }) =>(
            i.tcs_note_id =="喷码记录表已完成" ||
            i.tcs_note_id =="立案报告表已完成" ||
            i.tcs_note_id =="立案报告表审核已完成" ||
            i.tcs_note_id =="卷烟鉴别书已完成" ||
            i.tcs_note_id =="涉案烟草价品核案表完成" ||
            i.tcs_note_id =="询问笔录已完成" ||
            i.tcs_note_id =="无证经营公示已完成" ||
            i.tcs_note_id =="立案报告表主任审核已完成"||
            i.tcs_note_id=="卷烟鉴别书已送检"||
            i.tcs_note_id=="调查终结文书已完成"||
            i.tcs_note_id=="案件处理审批已开始"||
            i.tcs_note_id=="集体讨论已开始"||
            i.tcs_note_id=="集体讨论已完成"||
            i.tcs_note_id=="听证已开始"||
            i.tcs_note_id=="听证告知书已完成"||
            i.tcs_note_id=="听证已完成"||
            i.tcs_note_id=="案件处理审批已完成"||
            i.tcs_note_id=="行政处罚事先告知书确认完成"||
            i.tcs_note_id=="行政处罚事先告知书已完成"||
            i.tcs_note_id=="行政处罚决定书确认完成"||
            i.tcs_note_id=="行政处罚决定书已完成"||
            i.tcs_note_id=="行政罚款收据上传完成"||
            i.tcs_note_id=="行政罚款收据已完成"||
            i.tcs_note_id=="结案报告表已完成"||
            i.tcs_note_id=="喷码记录表填写开始"||
            i.tcs_note_id=="已完成"||
            i.tcs_note_id=="撤案集体讨论准备"||
            i.tcs_note_id=="撤案集体讨论已开始"||
            i.tcs_note_id=="卷烟鉴别抽样单填写开始"||
            i.tcs_note_id=="卷烟鉴别委托书填写开始"||
            i.tcs_note_id=="上传送检结果开始"
    )  )
    tableList.value = [];
    pageTotal.value = tableData.value.length;
    // 根据页码确定下标位置
    const index: number = query.pageIndex * query.pageSize - query.pageSize;
    for (let i = index; i < index + query.pageSize; i++) {
      // 防止数组下标越界
      if (i <= tableData.value.length - 1) {
        tableList.value.push(tableData.value[i])
      } else {
        // 越界就不再循环
        break;
      }
    }
  });
};
getData('','','','','','',localStorage.getItem('ms_username'));
// 查询操作
const handleSearch = (case_number:string='',tcs_note_id:string='',case_source:string='',case_type:string='') => {
  getData('','',case_source,case_type,case_number,tcs_note_id,name);
};
// 分页导航
const handlePageChange = (val: number) => {
  query.pageIndex = val;
  getData('','','','','','',localStorage.getItem('ms_username'));
};
</script>

<style scoped>
.handle-box {
  margin-bottom: 20px;
}
.handle-box button{
  background-color: #00a854;
}
/*:deep .el-select-dropdown{*/
/*  max-width: 243px;*/
/*}*/
/*:deep .el-select-dropdown__item{*/
/*  display: inline-block;*/
/*}*/
/*.el-select-dropdown__item span {*/
/*  min-width: 205px;*/
/*  display: inline-block;*/
/*}*/


.handle-select {
  width: 120px;
}

.handle-input {
  width: 300px;
}
.table {
  width: 100%;
  font-size: 14px;
}
.red {
  color: #ff0000;
}

:deep(.avatar){
  width: 100px;
  height: 100px;
}
.blue {
  color: rgba(0, 118, 252, 0.79);
}
.mr10 {
  margin-right: 10px;
}
.table-td-thumb {
  display: block;
  margin: auto;
  width: 40px;
  height: 40px;
}

/*#inspect_record{*/
/*  position: relative;*/
/*  left: 0px;*/
/*  top: -20px;*/

/*}*/

/*#filing_report_review{*/
/*  position: relative;*/
/*  left: 0px;*/
/*  top: -22px;*/
/*}*/
</style>
